import 'package:flutter/material.dart';
import 'package:im_flutter_sdk_example/jsonserialize/tag/data.dart';
import 'package:im_flutter_sdk_example/utils/global.dart';

class TagProvider with ChangeNotifier {
  TagModel _tagModel;
  get data => _tagModel;

  /// 初始化
  loadMyTags() async {
    var result = await G.req.user.myTags();
    if (result.data['status'] == 1) {
      _tagModel = TagModel.fromJson(result.data);
    }
    notifyListeners();
  }

  // 删除tag
  delTag(String label) async {
    var result = await G.req.user.delTag(tagName: label);
    if (result.data['status'] == 1) {
      loadMyTags();
    }
  }
}
